#include <stdio.h>
#include <errno.h>
#include "pramatrix.h"
#define ORDER 3
int main ()
{
	pra_matrix *a,*b,*c;
	double det;
	int eq;
	a=pra_matrix_alloc(ORDER,ORDER);
	b=pra_matrix_alloc(ORDER,ORDER);
	c=pra_matrix_alloc(ORDER,ORDER);
	pra_matrix_input(a);
	pra_matrix_input(b);
	
	printf("addition of two matrix\n");
	pra_matrix_add(a,b,c);
	pra_matrix_output(c);
	pra_matrix_set_to_null(c);
	
	printf("substraction of two matrix\n");
	pra_matrix_sub(a,b,c);
	pra_matrix_output(c);
	pra_matrix_set_to_null(c);
	
	printf("multiplication of two matrix\n");
	pra_matrix_multi(a,b,c);
	pra_matrix_output(c);
	pra_matrix_set_to_null(c);
	
	printf("nulling matrix \n");
	pra_matrix_output(c);
	
	printf("dot product of two matrix\n");
	pra_matrix_dot_product(a,b,c);
	pra_matrix_output(c);
	pra_matrix_set_to_null(c);
	
	det=pra_matrix_determinant(a,a->row);
	printf("determinant of matrix A=%lf\n",det);
	det=0;
	det=pra_matrix_determinant(b,b->row);
	printf("determinant of matrix B=%lf\n",det);
	
	printf("transpose of  matrix A\n");
	pra_matrix_transpose(a,a->row,c);
	pra_matrix_output(c);
	pra_matrix_set_to_null(c);
	
	printf("transpose of  matrix B\n");
	pra_matrix_transpose(b,b->row,c);
	pra_matrix_output(c);
	pra_matrix_set_to_null(c);
	
	printf("cofactor of  matrix A\n");
	pra_matrix_co_factor(a,a->row,c);
	pra_matrix_output(c);
	pra_matrix_set_to_null(c);
	
	printf("cofactor of  matrix B\n");
	pra_matrix_co_factor(b,b->row,c);
	pra_matrix_output(c);
	pra_matrix_set_to_null(c);
	
	printf("scalar product of 5*a\n");
	pra_matrix_scalar_product(a,5,c);
	pra_matrix_output(c);
	pra_matrix_set_to_null(c);
	
	printf("scalar product of 3*b\n");
	pra_matrix_scalar_product(b,3,c);
	pra_matrix_output(c);
	pra_matrix_set_to_null(c);
	
	printf("inverse of  matrix A\n");
	pra_matrix_inverse(a,c);
	pra_matrix_output(c);
	pra_matrix_set_to_null(c);
	
	printf("inverse of  matrix B\n");
	pra_matrix_inverse(b,c);
	pra_matrix_output(c);
	pra_matrix_set_to_null(c);
	
	eq=pra_matrix_equal(a,b);
	if(eq == 0) {
	printf("A and B are equal matrix \n");
	}else {
	printf ("A and B are not equal matrix\n");
	}

	eq=pra_matrix_symmetric (a);
	if(eq == 0) {
	printf("A is symetric matrix \n");
	}else {
	printf ("A is not symetric matrix\n");
	}
	eq=pra_matrix_symmetric(b);
	if(eq == 0) {
	printf("B is symetric matrix \n");
	}else {
	printf ("B is not symetric matrix\n");
	}
	pra_matrix_free(a);
	pra_matrix_free(b);
	pra_matrix_free(c);
  return 0;
}
 

